<?php

namespace common\models;

use Yii;
use yii\base\Model;

/**
 * ContactForm 常用联系人检查
 */
class ContactForm extends Model {
    public $id;
    public $name;
    public $gender;
    public $email;
    public $phone;
    public $birthday;
    public $ctime;
    public $mtime;
    public $owner_uid;


    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [
                'phone','string',
            ],
            [
                [
                    'id',
                    'owner_uid'
                ],
                'integer'
            ],
            [
                'name',
                'string',
                'max' => 32
            ],
            [
                'email',
                'email'
            ],
            [
                'birthday',
                'date',
                'format' => 'php:Y-m-d',
                'min' => '1930-01-01',
                'max' => date('Y-m-d'),
            ],
            [
                'gender',
                'in',
                'range' => [
                    0,
                    1,
                    2
                ]
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'name' => '名字',
            'gender' => '性别',
            'birthday' => '生日',
            'phone' => '手机号码',
        ];
    }
}
